#!/bin/sh

# Ensure Sunshine can grab images from KMS
path_to_setcap=$(which setcap)
path_to_sunshine=$(readlink -f $(which sunshine))
if [ -x "$path_to_setcap" ] ; then
  echo "$path_to_setcap cap_sys_admin+p $path_to_sunshine"
        $path_to_setcap cap_sys_admin+p $path_to_sunshine
fi

# Trigger udev rule reload for /dev/uinput and /dev/uhid
path_to_udevadm=$(which udevadm)
if [ -x "$path_to_udevadm" ] ; then
  $path_to_udevadm control --reload-rules
  $path_to_udevadm trigger --property-match=DEVNAME=/dev/uinput
  $path_to_udevadm trigger --property-match=DEVNAME=/dev/uhid
fi
